<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <script type="text/javascript" src="/test/js/jquery/jquery-2.2.4.js"></script>
    <script type="text/javascript">

        $(function () {
            $("#Save").click(function () {
                var adminPassword = $("#Savepassword").val(),
                        againpassword = $("#Saveagain").val(),
                        oldPassword = $("#oldPassword").val();
                if (checkout(adminPassword,againpassword,oldPassword)) {
                    var url = "/admin/edit";
                    $.post(url, {
                        adminPassword: adminPassword,
                        oldPassword: oldPassword
                    }, function (result) {
                        if (result.status === 1) {
                            alert("修改成功");
                            //window.location.href = "admin_index.html";
                        }
                        else {
                            alert("修改失败");
                            //window.location.href = "admin_editpwd.html";
                        }
                        //alert(JSON.stringify(result));
                    })
                }
                else {
                    alert("密码为空或密码不一致");
                }
            });
        })
        /**
         * 参数校验
         */
        function checkout(password,repassword,oldpassword) {
            if(password.length==0||repassword.length==0||oldpassword.length==0){
                return false;
            }
            if(repassword == password){
                return true;
            }
            return false;
        }
    </script>

    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>更改密码</h5>
                </div>
                <div class="ibox-content">
                    <div  class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">原密码</label>

                            <div class="col-sm-10">
                                <input id="oldPassword" type="password" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">新密码</label>

                            <div class="col-sm-10">
                                <input id="Savepassword" type="password" class="form-control" name="password">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">再输一遍新密码</label>

                            <div class="col-sm-10">
                                <input id="Saveagain" type="password" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button id="Save" class="btn btn-primary" type="submit">保存内容</button>
                                <button class="btn btn-white" type="submit">取消</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="js/content.js?v=1.0.0"></script>

<!-- iCheck -->
<script src="js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });
</script>


</body>

</html>
